package org.dut.mybatis.Controller;

import org.dut.mybatis.Service.UserService;
import org.dut.mybatis.model.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/user")
@RestController
public class UserController {
    @Autowired
    private UserService userServcie;

    @RequestMapping("/login")
    public Boolean login(String username, String password) {
        //SQL注入不一定发生，可通过逻辑避免
        List<UserInfo> userInfos = userServcie.queryUserByPassword(username, password);
        return userInfos != null && !userInfos.isEmpty();
    }
}
